<template>
	<view class="box">
		<view class="tipbox">
			<image src="../../static/images/location/location1.jpg" mode=""></image>
			<view class="tip_p1">
				请授权地理位置信息
			</view>
			<view class="butbox">
				<button type="default" @tap="location">重新授权</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onUnload() {
			
		},
		methods: {
			location(){
				console.log(123)
				uni.openSetting({
					success: (res) =>{
						console.log()
						if(!res.authSetting['scope.userLocation']){
							uni.showModal({
								title: '需要授权',
								content: '需要授权位置信息才能获取服务',
								confirmText: '重新授权',
								success: (res) => {
									console.log(res)
									if(res.confirm){
										uni.openSetting()
									}else{
										console.log('取消')
										uni.switchTab({
											url: '../index/index'
										})
									}
								}
							})
						}
					},
					fail: () => {
						uni.showModal({
							title: '需要授权',
							content: '需要授权位置信息才能获取服务',
							confirmText: '去设置'
						})
					}
				})
			}
		}
	}
</script>

<style scoped>
	.box{
		width: 100%;
		height: 100%;
		background-color: #ffffff;
		position: relative;
	}
	.tipbox{
		width: 100%;
		position: absolute;
		top: 35%;
		transform: translateY(-50%);
	}
	.tipbox image{
		width: 100%;
		height: 500rpx;
	}
	.tipbox .tip_p1{
		width: 100%;
		height: 50rpx;
		text-align: center;
		color: #676767;
		font-size: 0.8rem;
	}
	.tipbox .butbox{
		width: 100%;
		height: 70rpx;
		text-align: center;
		margin-top: 50rpx;
	}
	.butbox button{
		width: 250rpx;
		line-height: 70rpx;
		background-color: #008769;
		color: #FFFFFF;
		font-size: 0.9rem;
	}
</style>
